home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Demos / Component Software / FileFlex 2.0.3.sit / FileFlex 2.0.3 / Unsupported & Undocumented / Char Translation Example / 00001.ls next >
Encoding:
Text File  |  1996-04-10  |  6.9 KB  |  366 lines

  1. on DBInitPlatform
  2.   global gDBGlobalPtr1030
  3.   set gDBGlobalPtr1030 to EMPTY
  4. end
  5.  
  6. on DBClosePlatform
  7. end
  8.  
  9. on DBVersion
  10.   return FileFlex("0")
  11. end
  12.  
  13. on DBCopyright
  14.   return FileFlex("999")
  15. end
  16.  
  17. on DBOpenSession
  18.   global gDBActive1030
  19.   if gDBActive1030 <> "true" then
  20.     set gDBActive1030 to "true"
  21.     return FileFlex("1")
  22.   else
  23.     return "0"
  24.   end if
  25. end
  26.  
  27. on DBCloseSession
  28.   global gDBActive1030
  29.   if gDBActive1030 = "true" then
  30.     set gDBActive1030 to EMPTY
  31.     return FileFlex("2")
  32.   else
  33.     return "0"
  34.   end if
  35. end
  36.  
  37. on DBUse dbName, pathspec
  38.   DBCheckActive()
  39.   if the paramCount = 1 then
  40.     return FileFlex("3", dbName)
  41.   else
  42.     return FileFlex("3", dbName, pathspec)
  43.   end if
  44. end
  45.  
  46. on DBDatabaseExists dbName, pathspec
  47.   DBCheckActive()
  48.   if the paramCount = 1 then
  49.     return FileFlex("43", dbName)
  50.   else
  51.     return FileFlex("43", dbName, pathspec)
  52.   end if
  53. end
  54.  
  55. on DBClose dbID
  56.   DBCheckActive()
  57.   return FileFlex("4", string(dbID))
  58. end
  59.  
  60. on DBSelect dbID
  61.   DBCheckActive()
  62.   return FileFlex("5", string(dbID))
  63. end
  64.  
  65. on DBCloseAll
  66.   DBCheckActive()
  67.   return FileFlex("6")
  68. end
  69.  
  70. on DBUseIndex indexName, pathspec
  71.   DBCheckActive()
  72.   if the paramCount = 1 then
  73.     return FileFlex("7", indexName)
  74.   else
  75.     return FileFlex("7", indexName, pathspec)
  76.   end if
  77. end
  78.  
  79. on DBCloseIndex indexID
  80.   DBCheckActive()
  81.   return FileFlex("8", string(indexID))
  82. end
  83.  
  84. on DBSelectIndex indexID
  85.   DBCheckActive()
  86.   return FileFlex("9", string(indexID))
  87. end
  88.  
  89. on DBGo recnum
  90.   DBCheckActive()
  91.   return FileFlex("10", string(recnum))
  92. end
  93.  
  94. on DBTop
  95.   DBCheckActive()
  96.   return FileFlex("11")
  97. end
  98.  
  99. on DBBottom
  100.   DBCheckActive()
  101.   return FileFlex("12")
  102. end
  103.  
  104. on DBSeek seekExpr
  105.   DBCheckActive()
  106.   return FileFlex("13", seekExpr)
  107. end
  108.  
  109. on DBSkip num
  110.   DBCheckActive()
  111.   return FileFlex("14", string(num))
  112. end
  113.  
  114. on DBDeleteRecs startRec, endRec
  115.   DBCheckActive()
  116.   return FileFlex("15", string(startRec), string(endRec))
  117. end
  118.  
  119. on DBRecallRecs startRec, endRec
  120.   DBCheckActive()
  121.   return FileFlex("16", string(startRec), string(endRec))
  122. end
  123.  
  124. on DBZapRecs startRec, endRec
  125.   DBCheckActive()
  126.   return FileFlex("17", string(startRec), string(endRec))
  127. end
  128.  
  129. on DBPack
  130.   DBCheckActive()
  131.   return FileFlex("18")
  132. end
  133.  
  134. on DBCount
  135.   DBCheckActive()
  136.   return FileFlex("19")
  137. end
  138.  
  139. on DBRecordDeleted recnum
  140.   DBCheckActive()
  141.   return FileFlex("20", string(recnum))
  142. end
  143.  
  144. on DBCurrRecNum
  145.   DBCheckActive()
  146.   return FileFlex("21")
  147. end
  148.  
  149. on DBSum numFieldName
  150.   DBCheckActive()
  151.   return FileFlex("22", numFieldName)
  152. end
  153.  
  154. on DBAverage numFieldName
  155.   DBCheckActive()
  156.   return FileFlex("22", numFieldName) / FileFlex("19")
  157. end
  158.  
  159. on DBGetMemo memoField, encryptFlag, key
  160.   DBCheckActive()
  161.   if the paramCount = 1 then
  162.     return FileFlex("24", memoField)
  163.   else
  164.     return FileFlex("24", memoField, encryptFlag, key)
  165.   end if
  166. end
  167.  
  168. on DBWriteMemo memoField, memoVal, encryptFlag, key
  169.   DBCheckActive()
  170.   if the paramCount <= 2 then
  171.     return FileFlex("25", memoField, memoVal)
  172.   else
  173.     return FileFlex("25", memoField, memoVal, encryptFlag, key)
  174.   end if
  175. end
  176.  
  177. on DBGetFieldByName fieldName, decryptFlag, key
  178.   DBCheckActive()
  179.   if the paramCount = 1 then
  180.     return FileFlex("26", fieldName)
  181.   else
  182.     return FileFlex("26", fieldName, decryptFlag, key)
  183.   end if
  184. end
  185.  
  186. on DBGetFieldByNum fieldName, decryptFlag, key
  187.   DBCheckActive()
  188.   if the paramCount = 1 then
  189.     return FileFlex("27", string(fieldName))
  190.   else
  191.     return FileFlex("27", string(fieldName), decryptFlag, key)
  192.   end if
  193. end
  194.  
  195. on DBGetCurrRecVal containerType, decryptList, key
  196.   DBCheckActive()
  197.   if the paramCount = 1 then
  198.     return FileFlex("28", containerType)
  199.   else
  200.     return FileFlex("28", containerType, decryptList, key)
  201.   end if
  202. end
  203.  
  204. on DBListFields
  205.   DBCheckActive()
  206.   return FileFlex("29")
  207. end
  208.  
  209. on DBMaxRecs
  210.   DBCheckActive()
  211.   return FileFlex("47")
  212. end
  213.  
  214. on DBTranslateChars string, table
  215.   DBCheckActive()
  216.   return FileFlex("48", string, table)
  217. end
  218.  
  219. on DBWriteRec containerType, recnum, p0, p1, p2
  220.   if the paramCount = 2 then
  221.     return FileFlex("30", containerType, string(recnum))
  222.   else
  223.     if the paramCount = 3 then
  224.       return FileFlex("30", containerType, string(recnum), string(p0))
  225.     else
  226.       if the paramCount = 4 then
  227.         return FileFlex("30", containerType, string(recnum), string(p0), string(p1))
  228.       else
  229.         return FileFlex("30", containerType, string(recnum), string(p0), string(p1), string(p2))
  230.       end if
  231.     end if
  232.   end if
  233. end
  234.  
  235. on DBCreateIndex indexName, indexExpr, unique, safety
  236.   DBCheckActive()
  237.   return FileFlex("31", indexName, indexExpr, string(unique), string(safety))
  238. end
  239.  
  240. on DBSetSortOrder order
  241.   global gDBWorldSort, gDBSortOrder
  242.   if order = EMPTY then
  243.     set gDBWorldSort to EMPTY
  244.   else
  245.     set gDBWorldSort to "1"
  246.     set gDBSortOrder to order
  247.   end if
  248.   return 0
  249. end
  250.  
  251. on DBSetCaseTables upperTable, lowerTable
  252.   global gDBWorldCase, gDBWorldUpper, gDBWorldLower
  253.   if (upperTable = EMPTY) or (lowerTable = EMPTY) then
  254.     set gDBWorldCase to EMPTY
  255.   else
  256.     set gDBWorldCase to "1"
  257.     set gDBWorldUpper to upperTable
  258.     set gDBWorldLower to lowerTable
  259.   end if
  260.   return 0
  261. end
  262.  
  263. on DBUpper s
  264.   DBCheckActive()
  265.   return FileFlex("49", string(s))
  266. end
  267.  
  268. on DBLower s
  269.   DBCheckActive()
  270.   return FileFlex("50", string(s))
  271. end
  272.  
  273. on DBReindex indexID
  274.   DBCheckActive()
  275.   return FileFlex("32", string(indexID))
  276. end
  277.  
  278. on DBIndexExpr indexID
  279.   DBCheckActive()
  280.   return FileFlex("44", string(indexID))
  281. end
  282.  
  283. on DBBuildSeekExpr
  284.   DBCheckActive()
  285.   set theFunc to "FileFlex(" & QUOTE & "45" & QUOTE
  286.   repeat with i = 1 to the paramCount
  287.     put "," & QUOTE & string(param(i)) & QUOTE after theFunc
  288.   end repeat
  289.   put ")" after theFunc
  290.   return value(theFunc)
  291. end
  292.  
  293. on DBListIndexFields indexID, delim
  294.   DBCheckActive()
  295.   return FileFlex("46", string(indexID), string(delim))
  296. end
  297.  
  298. on DBCreate dbName, numFields, fields, safety
  299.   DBCheckActive()
  300.   return FileFlex("33", dbName, string(numFields), fields, string(safety))
  301. end
  302.  
  303. on DBCheckIndex indexID
  304.   DBCheckActive()
  305.   return FileFlex("34", string(indexID))
  306. end
  307.  
  308. on DBQuery expr
  309.   DBCheckActive()
  310.   return FileFlex("35", expr)
  311. end
  312.  
  313. on DBLocate expr
  314.   DBCheckActive()
  315.   return FileFlex("35", expr)
  316. end
  317.  
  318. on DBCurrDBNum
  319.   DBCheckActive()
  320.   return FileFlex("36")
  321. end
  322.  
  323. on DBEncrypt theString, key
  324.   DBCheckActive()
  325.   return FileFlex("38", theString, key)
  326. end
  327.  
  328. on DBDecrypt theString, key
  329.   DBCheckActive()
  330.   return FileFlex("39", theString, key)
  331. end
  332.  
  333. on DBFindMemo memoField, theString
  334.   DBCheckActive()
  335.   return FileFlex("40", memoField, theString)
  336. end
  337.  
  338. on DBConvertCRLF theString, theOption
  339.   DBCheckActive()
  340.   if the paramCount = 1 then
  341.     return FileFlex("41", theString)
  342.   else
  343.     return FileFlex("41", theString, theOption)
  344.   end if
  345. end
  346.  
  347. on DBPlatform
  348.   DBCheckActive()
  349.   return FileFlex("42")
  350. end
  351.  
  352. on DBCheckActive
  353.   global gDBActive1030
  354.   if gDBActive1030 <> "true" then
  355.     set dummy to DBOpenSession()
  356.   end if
  357. end
  358.  
  359. on DBSetGlobal globName, globVal
  360.   return FileFlex("202", string(globName), string(globVal))
  361. end
  362.  
  363. on DBGetGlobal globName
  364.   return FileFlex("201", string(globName))
  365. end
  366.